﻿<UserControl xmlns:Controls="clr-namespace:Flare.Controls"  x:Class="Flare.Pages.ITContract.Provider"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d"
      xmlns:base="clr-namespace:Flare.DB"
      d:DesignHeight="600" d:DesignWidth="1200">

    <UserControl.Resources>
        <ObjectDataProvider x:Key="contract_providersDataSet" ObjectType="{x:Type base:contract_providers}" MethodName="Index" IsAsynchronous="False"/>
    </UserControl.Resources>

    <DockPanel LastChildFill="False" VerticalAlignment="Top">
        <Controls:FlameTbox x:Name="provider" Header="Поставщик услуги" Margin="10,0,0,0" DockPanel.Dock="Top" Width="600"                
                            Text="{Binding SelectedItem.provider, ElementName=ProvidersList}" />

        <Controls:FlameTbox x:Name="provider_address" Header="Адрес" Margin="10,10,0,0" DockPanel.Dock="Top" Width="882"                
                            Text="{Binding SelectedItem.provider_address, ElementName=ProvidersList}" />

        <Controls:FlameTbox x:Name="default_contract_number" Header="Номер договора (по умолчанию)" Margin="10,10,0,0" DockPanel.Dock="Top" Width="600"                
                            Text="{Binding SelectedItem.default_contract_number, ElementName=ProvidersList}" />
               
        <StackPanel Orientation="Horizontal" Margin="10,40,0,40" DockPanel.Dock="Top">
            <Button x:Name="ButtonAdd" Content="Добавить" HorizontalAlignment="Left" Click="ButtonAdd_Click" />
            <Button x:Name="ButtonSave" Content="Сохранить" HorizontalAlignment="Left" Margin="8,0,0,0" Click="ButtonSave_Click" Visibility="Collapsed" />
            <Button x:Name="ButtonDelete" Content="Удалить" HorizontalAlignment="Left" Margin="8,0,0,0" Click="ButtonDelete_Click" Visibility="Collapsed" />
            <Button x:Name="ButtonClose" Content="Отмена" HorizontalAlignment="Left" Margin="8,0,0,0" Click="ButtonClose_Click" Visibility="Collapsed" />
        </StackPanel>
        
        <ListBox Name="ProvidersList" ItemsSource="{Binding Source={StaticResource contract_providersDataSet}}" ItemContainerStyle="{StaticResource ProviderItemTemplate}" 
                 SelectedValuePath="id_provider" HorizontalAlignment="Stretch" Style="{StaticResource StyleListBox}" DockPanel.Dock="Top" 
                 SelectionChanged="ProvidersList_SelectionChanged" />
    </DockPanel>
    
</UserControl>
